<div :class="{ 'grid': true, 'show-paging-bar': isEnablePagingBar, 'hidden-paging-bar': !isEnablePagingBar }">
    <i-form>
    <el-table v-if="isDisplay === true"
        :default-sort="{ prop: minorSortPSDEF, order: Object.is(minorSortDir, 'ASC') ? 'ascending' : Object.is(minorSortDir, 'DESC') ? 'descending' : '' }"  
        @sort-change="onSortChange($event)"  
        :border="isDragendCol"
        :span-method="arraySpanMethod.bind(_self)"
        :highlight-current-row ="isSingleSelect"
        :row-class-name="getRowClassName.bind(_self)"
        :cell-class-name="getCellClassName.bind(_self)"
        size="mini"
        stripe
        rowKey="id"
        :height="tableHeight"
        :treeProps="{children: 'items', hasChildren: 'hasChildren'}"
        @row-click="rowClick($event)"  
        @select-all="selectAll($event)"  
        @select="select($event)"  
        @row-class-name="onRowClassName($event)"  
        @row-dblclick="rowDBLClick($event)"  
        ref='multipleTable' :data="items" :show-header="!isHideHeader">
            <template slot="empty">
                无数据 
            </template>
            <template v-if="!isSingleSelect">
                <el-table-column align="center" type='selection' :width="checkboxColWidth"></el-table-column>
            </template>
            <template v-if="getColumnState('id')">
                <el-table-column show-overflow-tooltip :prop="'id'" :label="$t('entities.task.main_grid.columns.id')" :width="150"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.id')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                            <span>{{row.id}}</span>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('pri')">
                <el-table-column show-overflow-tooltip :prop="'pri'" :label="$t('entities.task.main_grid.columns.pri')" :width="80"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.pri')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                        <template >
            <codelist :value="row.pri" tag="Task__pri" codelistType="STATIC" ></codelist>
                        </template>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('name')">
                <el-table-column show-overflow-tooltip :prop="'name'" :label="$t('entities.task.main_grid.columns.name')" :min-width="500"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.name')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                        <template >
                                  <span> <app-column-link
                    deKeyField="task"
                     :context="JSON.parse(JSON.stringify(context))"
                     :viewparams="JSON.parse(JSON.stringify(viewparams))"
                     :data="row"
                     :linkview="{viewname: 'task-main-dashboard-view', height: 0,width: 1360,title: $t('entities.task.views.maindashboardview.title'),placement: 'DRAWER_TOP', isRedirectView: false,deResParameters: [
                        { pathName: 'stories', parameterName: 'story' },
                        ]
                        ,parameters: [
                        { pathName: 'tasks', parameterName: 'task' },
                        { pathName: 'maindashboardview', parameterName: 'maindashboardview' }
                        ]}"
                                        valueitem="srfkey"
                                    >
            <span v-if="row.tasktype === '10'">
            	<span title="多人任务" style="color: #3c4353;background-color: #ddd;border-radius: 9px;padding: 3px 5px;display: inline-block;line-height: 1;vertical-align: middle">多人</span>
            	<span :style="{'color':row.color}"> {{row.name}}</span>
            </span>
            <span v-else-if="row.tasktype === '20'">
            	<span title="父任务" style="color: #3c4353;background-color: #ddd;border-radius: 9px;padding: 3px 5px;display: inline-block;line-height: 1;vertical-align: middle">父</span>
            	<span :style="{'color':row.color}"> {{row.name}}</span>
            </span>
            <span v-else-if="row.tasktype === '30'">
            	<span :style="{'color':row.color}">{{row.name}}</span>
            </span>
            <span v-else>
              <span title="子任务" style="color: #3c4353;background-color: #ddd;border-radius: 9px;padding: 3px 5px;display: inline-block;line-height: 1;vertical-align: middle">子</span>
            	<span :style="{'color':row.color}"> {{row.name}}</span>
            </span>
            </app-column-link></span>
                        </template>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('status1')">
                <el-table-column show-overflow-tooltip :prop="'status1'" :label="$t('entities.task.main_grid.columns.status1')" :width="100"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.status1')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                        <template >
            <codelist :value="row.status1" tag="TaskStatusCK" codelistType="STATIC" ></codelist>
                        </template>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('deadline')">
                <el-table-column show-overflow-tooltip :prop="'deadline'" :label="$t('entities.task.main_grid.columns.deadline')" :width="150"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.deadline')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                        <template >
                                  <span><span v-if="row.delay" style="color:red">
            	<app-format-data format="YYYY-MM-DD" :data="row.deadline"></app-format-data> <span>{{ row.delay }}</span>
            </span>
            <span v-else>
            	<app-format-data format="YYYY-MM-DD" :data="row.deadline"></app-format-data>
            </span>
            </span>
                        </template>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('assignedto')">
                <el-table-column show-overflow-tooltip :prop="'assignedto'" :label="$t('entities.task.main_grid.columns.assignedto')" :width="110"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.assignedto')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                        <template >
                                  <span><span><span v-if="row.tasktype != '10'">
                <a v-show="row.AssignTask.visible" :disabled="row.AssignTask.disabled" :style="{'display': 'block'}" @click="uiAction(row, 'AssignTask', $event)">
                    <i class="fa fa-hand-o-right" title="指派" style="float: left;padding-top: 5px;padding-right: 5px;"></i>
                    <app-user-span
                            :value="row.assignedto"
                            :context="JSON.parse(JSON.stringify(context))"
                            tag="UserRealNameUnAssignTo_Gird"
                            codelistType="DYNAMIC"
                            renderMode="STR"
                            valueSeparator=","
                            textSeparator=","
                    >
                    </app-user-span>
                </a>
            </span>
            <span v-else>
                <a v-show="row.CheckForward.visible" :disabled="row.CheckForward.disabled" :style="{'display': 'block'}" @click="uiAction(row, 'CheckForward', $event)">
                    <i class="fa fa-mail-forward" title="转交" style="float: left;padding-top: 5px;padding-right: 5px;"></i>
                    <app-user-span
                            :value="row.assignedto"
                            :context="JSON.parse(JSON.stringify(context))"
                            tag="UserRealNameUnAssignTo_Gird"
                            codelistType="DYNAMIC"
                            renderMode="STR"
                            valueSeparator=","
                            textSeparator=","
                    >
                    </app-user-span>
                </a>
            </span></span></span>
                        </template>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('finishedby')">
                <el-table-column show-overflow-tooltip :prop="'finishedby'" :label="$t('entities.task.main_grid.columns.finishedby')" :width="100"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.finishedby')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                        <template >
            <codelist :value="row.finishedby" tag="UserRealName_Gird" codelistType="DYNAMIC" renderMode="STR" valueSeparator="," textSeparator="," ></codelist>
                        </template>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('estimate')">
                <el-table-column show-overflow-tooltip :prop="'estimate'" :label="$t('entities.task.main_grid.columns.estimate')" :width="100"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.estimate')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                            <app-format-data dataType="FLOAT" precision="0" :data="row.estimate"></app-format-data>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('consumed')">
                <el-table-column show-overflow-tooltip :prop="'consumed'" :label="$t('entities.task.main_grid.columns.consumed')" :width="100"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.consumed')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                            <app-format-data dataType="FLOAT" precision="2" :data="row.consumed"></app-format-data>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('left')">
                <el-table-column show-overflow-tooltip :prop="'left'" :label="$t('entities.task.main_grid.columns.left')" :width="100"  :align="'left'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.left')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                            <app-format-data dataType="FLOAT" precision="2" :data="row.left"></app-format-data>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('progressrate')">
                <el-table-column show-overflow-tooltip :prop="'progressrate'" :label="$t('entities.task.main_grid.columns.progressrate')" :width="80"  :align="'left'" :sortable="'custom'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.progressrate')}}
                       </span>
                    </template>
                    <template v-slot="{row,column,$index}">
                            <span>{{row.progressrate}}</span>
                    </template>
                </el-table-column>
            </template>
            <template v-if="getColumnState('uagridcolumn1')">
                <el-table-column :column-key="'uagridcolumn1'" fixed="right" :label="$t('entities.task.main_grid.columns.uagridcolumn1')" :width="270"  :align="'center'">
                    <template v-slot:header="{column}">
                       <span class="column-header ">
                        {{$t('entities.task.main_grid.columns.uagridcolumn1')}}
                       </span>
                    </template>
                    <template slot-scope="scope">
                        <template v-if="scope.row.children">
                            <span>
                                <a :title="scope.row.tooltip" @click="loadMore(scope.row)">{{ scope.row.toolcaption }}</a>
                            </span>
                        </template>
                        <div v-else style="text-align: center;">
                            <a v-show="scope.row.TaskToBug.visible" :disabled="scope.row.TaskToBug.disabled" @click="uiAction(scope.row, 'TaskToBug', $event)" :title="$t('entities.task.main_grid.uiactions.task_tasktobug')">
                                <i class="fa fa-bug"></i>
                                
                            </a>
                            <divider v-show="scope.row.confirmStoryChange.visible" type="vertical"></divider>
                            <a v-show="scope.row.confirmStoryChange.visible" :disabled="scope.row.confirmStoryChange.disabled" @click="uiAction(scope.row, 'confirmStoryChange', $event)" :title="$t('entities.task.main_grid.uiactions.task_confirmstorychange')">
                                <i class="fa fa-search"></i>
                                
                            </a>
                            <divider v-show="scope.row.MStartTaskDash1.visible" type="vertical"></divider>
                            <a v-show="scope.row.MStartTaskDash1.visible" :disabled="scope.row.MStartTaskDash1.disabled" @click="uiAction(scope.row, 'MStartTaskDash1', $event)" :title="$t('entities.task.main_grid.uiactions.task_mstarttaskdash1')">
                                <i class="fa fa-play-circle-o"></i>
                                
                            </a>
                            <divider v-show="scope.row.CloseTask.visible" type="vertical"></divider>
                            <a v-show="scope.row.CloseTask.visible" :disabled="scope.row.CloseTask.disabled" @click="uiAction(scope.row, 'CloseTask', $event)" :title="$t('entities.task.main_grid.uiactions.task_closetask')">
                                <i class="fa fa-power-off"></i>
                                
                            </a>
                            <divider v-show="scope.row.done.visible" type="vertical"></divider>
                            <a v-show="scope.row.done.visible" :disabled="scope.row.done.disabled" @click="uiAction(scope.row, 'done', $event)" :title="$t('entities.task.main_grid.uiactions.task_done')">
                                <i class="fa fa-check-square-o"></i>
                                
                            </a>
                            <divider v-show="scope.row.MainEdit.visible" type="vertical"></divider>
                            <a v-show="scope.row.MainEdit.visible" :disabled="scope.row.MainEdit.disabled" @click="uiAction(scope.row, 'MainEdit', $event)" :title="$t('entities.task.main_grid.uiactions.task_mainedit')">
                                <i class="fa fa-edit"></i>
                                
                            </a>
                            <divider v-show="scope.row.NewSubTask.visible" type="vertical"></divider>
                            <a v-show="scope.row.NewSubTask.visible" :disabled="scope.row.NewSubTask.disabled" @click="uiAction(scope.row, 'NewSubTask', $event)" :title="$t('entities.task.main_grid.uiactions.task_newsubtask')">
                                <i class="iconfont studio-icon-subnets"></i>
                                
                            </a>
                            <divider v-show="scope.row.Copy.visible" type="vertical"></divider>
                            <a v-show="scope.row.Copy.visible" :disabled="scope.row.Copy.disabled" @click="uiAction(scope.row, 'Copy', $event)" :title="$t('entities.task.main_grid.uiactions.copy')">
                                <i class="fa fa-copy"></i>
                                
                            </a>
                            <divider v-show="scope.row.TaskFavorites.visible" type="vertical"></divider>
                            <a v-show="scope.row.TaskFavorites.visible" :disabled="scope.row.TaskFavorites.disabled" @click="uiAction(scope.row, 'TaskFavorites', $event)" :title="$t('entities.task.main_grid.uiactions.task_taskfavorites')">
                                <i class="fa fa-star-o"></i>
                                
                            </a>
                            <divider v-show="scope.row.TaskNFavorites.visible" type="vertical"></divider>
                            <a v-show="scope.row.TaskNFavorites.visible" :disabled="scope.row.TaskNFavorites.disabled" @click="uiAction(scope.row, 'TaskNFavorites', $event)" :title="$t('entities.task.main_grid.uiactions.task_tasknfavorites')">
                                <i class="fa fa-star"></i>
                                
                            </a>
                        </div>
                    </template>
                </el-table-column>
            </template>
            <template v-if="adaptiveState">
                <el-table-column></el-table-column>
            </template>
    </el-table>
    <row class='grid-pagination' v-show="items.length > 0">
        <page class='pull-right' @on-change="pageOnChange($event)" 
            @on-page-size-change="onPageSizeChange($event)"
            :transfer="true" :total="totalRecord"
            show-sizer :current="curPage" :page-size="limit"
            :page-size-opts="[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]" show-elevator show-total>
            <span>
                <span class="page-column">
                    <poptip transfer placement="top-start">
                        <i-button icon="md-menu">{{$t('app.gridpage.choicecolumns')}}</i-button>
                        <div slot="content">
                            <template v-for="col in allColumns">
                                <div :key="col.name"><el-checkbox v-model="col.show" @change="onColChange()">{{$t(col.langtag)}}</el-checkbox></div>
                            </template>
                        </div>
                    </poptip>
                </span>
                <span v-if="selections.length > 0" class="batch-toolbar">
                </span>
                <span class="page-button"><i-button icon="md-refresh" :title="$t('app.gridpage.refresh')" @click="pageRefresh()"></i-button></span>&nbsp;
                <span>
                    {{$t('app.gridpage.show')}}&nbsp;
                    <span>
                        <template v-if="items.length === 1">
                        1
                        </template>
                        <template v-else>
                            <span>{{(curPage - 1) * limit + 1}}&nbsp;-&nbsp;{{totalRecord > curPage * limit ? curPage * limit : totalRecord}}</span>
                        </template>
                    </span>&nbsp;
                    {{$t('app.gridpage.records')}}，{{$t('app.gridpage.totle')}}&nbsp;{{totalRecord}}&nbsp;{{$t('app.gridpage.records')}}
                </span>
            </span>
        </page>
    </row>
  </i-form>
</div>